

class MonitorTask implements Runnable{
	private volatile boolean flag = false;  
	private String word;
	public void stopMe(){
		this.flag  = true;
		Thread.yield();
	}
	public void sendWord(String word){
		this.word = word;
	}
	@Override
	public void run() {
		while(!flag){
			if (this.word != null&&this.word.contains("alien")){
				System.out.println(Thread.currentThread().getName()+" found alien in "+this.word);
				this.word = null;
				Thread.yield();
			}
		}
		System.out.println(Thread.currentThread().getName() + " stop");
	}
	
}
